﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/Admin.master" AutoEventWireup="true" CodeFile="BaiViet.aspx.cs" Inherits="Admin_BaiViet" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="formBox">
    <h2>Danh sách bài viết</h2>
    <p><a href="ThemBaiViet.aspx">Thêm mới</a></p>
        <asp:GridView ID="GridBaiViet" runat="server" AutoGenerateColumns="False" 
            Width="100%" DataSourceID="EntityDataSource1" AllowPaging="True" 
            onrowcommand="GridBaiViet_RowCommand" 
            onrowcreated="GridBaiViet_RowCreated" onrowdatabound="GridBaiViet_RowDataBound">
            <Columns>
                <asp:BoundField DataField="BaiVietID" HeaderText="ID" />
                <asp:ImageField HeaderText="Hình đại diện" DataImageUrlField="HinhDaiDien" 
                    DataImageUrlFormatString="~/Photos/BaiViet/{0}">
                    <ControlStyle Width="60px" />
                </asp:ImageField>
                <asp:BoundField DataField="TuaBaiViet" HeaderText="Tựa bài" />
                <asp:TemplateField HeaderText="The loai">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Convert.ToInt32(Eval("TheLoai"))==1?"Trang chu":
                                                                         (Convert.ToInt32(Eval("TheLoai"))==2?"Tin tuc lien quan":
                                                                         (Convert.ToInt32(Eval("TheLoai"))==3?"Cam nan am thuc":"Su kien"))%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/delete.png"
                    ShowDeleteButton="True">
                <ControlStyle Width="25px" />
                </asp:CommandField>
                <asp:ButtonField ButtonType="Image" CommandName="Sua" 
                    ImageUrl="~/Images/edit.png" Text="Button">
                <ControlStyle Width="25px" />
                </asp:ButtonField>
            </Columns>
            <HeaderStyle CssClass="bgAdminTitle" />
        </asp:GridView>
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
            ConnectionString="name=EDiamondEntities1" 
            DefaultContainerName="EDiamondEntities1" EnableFlattening="False" 
            EntitySetName="BaiViets" OrderBy="it.BaiVietID DESC">
        </asp:EntityDataSource>
</div>
</asp:Content>

